package com.hhkj.study.admin.resource.entity;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.core.domain.BizBaseEntity;
import com.ruoyi.common.valid.VAdd;
import com.ruoyi.common.valid.VDisable;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
*
* @author SERVER
* @since 2024-09-06
*/
@TableName(value = "x_resource_question_bank")
@EqualsAndHashCode(callSuper = true)
@Data
public class ResourceQuestionBank extends ResourceCourseBase {

	/**
	 * 名称
	*/
	@NotBlank(message = "名称不能为空", groups = VAdd.class)
	private String name;
	/**
	 * 课程小类,字典表中id
	*/
	@NotNull(message = "课程小类不能为空", groups = VAdd.class)
	private Long courseType;
	/**
	 * 关联建培圈题库id
	*/
	private Long assoBankId;
	/**
	 * 关联建培圈题库名称
	*/
	private String assoBankName;

	/**
	 * 关联建培圈课程id
	 */
	private Long assoCourseId;
	/**
	 * 年份
	*/
	private String year;
	/**
	 * 题目总数
	*/
	private Integer questionCount;
	/**
	 * 说明
	*/
	private String remark;
	/**
	 * 是否展示（0-上架， 1-下架）
	*/
	@NotNull(message = "上架状态不能为空", groups = {VAdd.class, VDisable.class})
	private Integer publishedFlag;
	/**
	 * 排序序号
	*/
	private Integer orderNum;

	@Override
	public Long getResourceCount() {
		return ObjectUtil.isNull(this.questionCount) ? 0L : this.questionCount;
	}

	@NotNull(message = "类型不能为空", groups = VAdd.class)
	@Override
	public Long getType() {
		return super.getType();
	}
}